package com.example.beautymakeup.dao;

import com.example.beautymakeup.pojo.Cart;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CartDao {
    @Insert("insert into cart (userId,shopId) values (#{userId},#{shopId});")
    int add(Cart cart);

    @Select("select c.*,s.shopName,s.shopImage,s.price,count(*) as 'num' from cart c,shop s where c.shopId = s.uid and c.userId = #{userId} GROUP BY c.shopId;")
    List<Cart> get(Cart cart);

    @Delete("delete from cart where shopId = #{shopId} and userId = #{userId};")
    int delete(Cart cart);
    @Select("select count(*) from cart where userId = #{userId};")
    int getCount(Cart cart);

}
